package com.shzu.jwc.ty.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shzu.jwc.ty.bean.TheoreticalPaperModel;
import com.shzu.jwc.ty.dao.TheoreticalPaperModelMapper;

@Service
public class PaperModelservice {
	
	@Autowired
	TheoreticalPaperModelMapper mapper;
	
	public List<TheoreticalPaperModel> getpapermodel()
	{
		return mapper.selectByExample(null);
	}
	
	public Integer insertpapermodel(TheoreticalPaperModel theoreticalPaperModel)
	{
		return mapper.insert(theoreticalPaperModel);
	}
	
	public Integer deletepapermodel(Integer theoreticalPaperModelId)
	{
		return mapper.deleteByPrimaryKey(theoreticalPaperModelId);
	}
	
	public Integer updatepapermodel(String column,Integer value,Integer id)
	{
		TheoreticalPaperModel theoreticalPaperModel=mapper.selectByPrimaryKey(id);
		if(column.equals("theoreticalPaperModelTime"))
			theoreticalPaperModel.setTheoreticalPaperModelTime(value);
		if(column.equals("theoreticalPaperModelChooseNumber"))
			theoreticalPaperModel.setTheoreticalPaperModelChooseNumber(value);
		if(column.equals("theoreticalPaperModelJudgeNumber"))
			theoreticalPaperModel.setTheoreticalPaperModelJudgeNumber(value);
		if(column.equals("theoreticalPaperModelChooseTime"))
			theoreticalPaperModel.setTheoreticalPaperModelChooseTime(value);
		if(column.equals("theoreticalPaperModelJudgeTime"))
			theoreticalPaperModel.setTheoreticalPaperModelJudgeTime(value);
		return mapper.updateByPrimaryKey(theoreticalPaperModel);
	}

}
